import { IPSChartCoordinateSystemSingle } from './ipschart-coordinate-system-single';
import { IPSChartSingle } from './ipschart-single';
import { PSDEChartCoordinateSystemImplBase } from './psdechart-coordinate-system-impl-base';

export class PSDEChartCoordinateSystemSingleImpl extends PSDEChartCoordinateSystemImplBase implements IPSChartCoordinateSystemSingle {
  protected pschartsingle: IPSChartSingle | null = null;

  getPSChartSingle(): IPSChartSingle | null {
    if (this.pschartsingle != null) return this.pschartsingle;
    const value = this.M.getPSChartSingle;
    if (value == null) {
      return null;
    }
    this.pschartsingle = this.getPSModel4('control.chart.IPSChartSingle', value, 'getPSChartSingle') as IPSChartSingle;
    return this.pschartsingle;
  }

  get psChartSingle(): IPSChartSingle | null {
    return this.getPSChartSingle();
  }

  getPSChartSingleMust(): IPSChartSingle {
    const value = this.getPSChartSingle();
    if (value == null) {
      throw new Error('未指定单坐标系界面对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEChartCoordinateSystemSingleImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.chart.IPSChartCoordinateSystemSingle') return true;
    return super.instanceof(cls);
  }
}
